//
//  NSError+MHExtension.m
//  WeChat
//
//  Created by senba on 2017/5/22.
//  Copyright © 2017年 CoderMikeHe. All rights reserved.
//

#import "NSError+MHExtension.h"


@implementation NSError (MHExtension)
+ (NSString *)mh_tipsFromError:(NSError *)error{
    if (!error) return nil;
    NSString *tipStr = nil;
    /// 这里需要处理HTTP请求的错误
//    if (error.userInfo[HTTPServiceErrorDescriptionKey]) {
//        tipStr = [error.userInfo objectForKey:HTTPServiceErrorDescriptionKey];
//    }else if (error.userInfo[HTTPServiceErrorDescriptionKey]) {
//        tipStr = [error.userInfo objectForKey:HTTPServiceErrorDescriptionKey];
//    }else
//    NSLog(@"aaa==%@",[error.userInfo objectForKey:@"errorMsg"]);
//        if (error.domain) {
//        tipStr = error.localizedFailureReason;
//    } else {
//        tipStr = error.localizedDescription;
//    }
    tipStr = [error.userInfo objectForKey:@"errorMsg"];
#if defined(DEBUG)||defined(_DEBUG)
    tipStr = LNStringIsNotEmpty(tipStr)?[NSString stringWithFormat:@"%@",tipStr]:[NSString stringWithFormat:@"请求超时，请重新刷新页面~"];                 /// 调试模式
#else
    tipStr = LNStringIsNotEmpty(tipStr)?tipStr:@"请求超时，请重新刷新页面~";/// 发布模式
#endif
    return tipStr;
}
@end
